package com.atguigu.javaailangchain4j.controller;

import com.atguigu.javaailangchain4j.agent.SeparateChatAssistant;
import com.atguigu.javaailangchain4j.entity.ChatFormVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@RestController
@RequestMapping("/xiaozhi")
public class XiaozhiController {

    @Autowired
    private SeparateChatAssistant separateChatAssistant;

    @PostMapping("/chat")
    public String chat(@RequestBody ChatFormVO chatFormVO) {
        return separateChatAssistant.chat(chatFormVO.getMemoryId(), chatFormVO.getMessage());
    }
    @PostMapping("/chat1")
    public Flux<String> chat1(@RequestBody ChatFormVO chatFormVO) {
        return separateChatAssistant.chat1(chatFormVO.getMemoryId(), chatFormVO.getMessage());
    }
}